<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <link rel="stylesheet" href="./node_modules/layui-src/dist/css/layui.css" />
    <script type="text/javascript" src="./js/layui/layui.all.js"></script>
    <script type="text/javascript" src="./node_modules/jquery/dist/jquery.min.js"></script>
    <script type="text/javascript" src="./js/config.js"></script>
</head>
<body>
    <table style="width: 100%;">
        <tr style="height: 30px;">
            <td colspan="4" style="font-size: large; text-align: center;">基本信息（必填）</td>
        </tr>
        <tr style="height: 36px;">
            <td style="width: 120px; text-align: right;">部门</td>
            <td style="width: 120px;"><input id="deptcode" type="text" style="width: 100%;"></td>
            <td style="width: 120px; text-align: right;">老生</td>
            <td style="width: 120px;"><input id="gstudent" type="text" style="width: 100%;"></td>
            <td></td>
        </tr>
        <tr style="height: 36px;">
            <td style="text-align: right;">班主任姓名</td>
            <td style="width: 120px;"><input id="hteacher" type="text" style="width: 100%;"></td>
            <td style="width: 120px; text-align: right;">老生班级</td>
            <td style="width: 120px;"><input id="gclass" type="text" style="width: 100%;"></td>
            <td></td>
        </tr>
        <tr style="height: 36px;">
            <td style="text-align: right;">班主任联系方式</td>
            <td style="width: 120px;"><input id="mbphone" type="text" style="width: 100%;"></td>
            <td style="width: 120px; text-align: right;">老生联系方式</td>
            <td style="width: 120px;"><input id="gstudentphone" type="text" style="width: 100%;"></td>
            <td></td>
        </tr>
        <!-- 被介绍学生信息 -->
        <tr style="height: 30px;">
            <td colspan="4" style="font-size: large; text-align: center;">被介绍学生信息（必填）</td>
        </tr>
        <tr style="height: 36px;">
            <td style="width: 120px; text-align: right;">被介绍学生</td>
            <td style="width: 120px;"><input id="pstudent" type="text" style="width: 100%;"></td>
            <td style="width: 180px; text-align: right;">是否需要咨询师回访</td>
            <td style="width: 120px;"><input id="cflag" type="text" style="width: 100%;"></td>
            <td></td>
        </tr>
        <tr style="height: 36px;">
            <td style="text-align: right;">联系电话</td>
            <td style="width: 120px;"><input id="pstudentphone" type="text" style="width: 100%;"></td>
            <td style="width: 180px; text-align: right;">是否需要直播参观</td>
            <td style="width: 120px;"><input id="vflag" type="text" style="width: 100%;"></td>
            <td></td>
        </tr>
        <tr style="height: 36px;">
            <td style="text-align: right;">地区</td>
            <td style="width: 120px;"><input id="district" type="text" style="width: 100%;"></td>
            <td rowspan="2" style="width: 120px; text-align: right;">备注</td>
            <td rowspan="2" style="width: 120px;"><textarea id="cbrief" style="width: 100%; height: 100%;"></textarea></td>
            <td></td>
        </tr>
        <tr style="height: 36px;">
            <td style="text-align: right;">预计来校时间</td>
            <td style="width: 120px;"><input id="pentertime" type="text" style="width: 100%;"></td>
            <td></td>
        </tr>
        <tr style="height: 30px;">
            <td colspan="4" style="text-align: center;">
                <button class="layui-btn layui-btn-normal" id="cmdSubmit">提交</button>
            </td>
        </tr>
        <tr>
            <td colspan="4" style="height: 30px; padding: 0px 0px 0px 10px; text-align: center; color: red;">
                请严格按真实数据填写，一经填写不可更改
            </td>
        </tr>
        <tr>
            <td id="hmsg" colspan="4" style="height: 30px; padding: 0px 0px 0px 10px;">

            </td>
        </tr>
    </table>

    <script>
        $(document).ready(() => {
            $("#cmdSubmit").on("click", () => {
                let formData = new FormData();

                let deptcode = $("#deptcode").val();
                let gstudent = $("#gstudent").val();
                let hteacher = $("#hteacher").val();
                let gclass = $("#gclass").val();
                let mbphone = $("#mbphone").val();
                let gstudentphone = $("#gstudentphone").val();
                let pstudent = $("#pstudent").val();
                let cflag = $("#cflag").val();
                let pstudentphone = $("#pstudentphone").val();
                let vflag = $("#vflag").val();
                let district = $("#district").val();
                let pentertime = $("#pentertime").val();
                let cbrief = $("#cbrief").val();

                formData.append("cbrief", cbrief);
                formData.append("pentertime", pentertime);
                formData.append("district", district);
                formData.append("vflag", vflag);
                formData.append("pstudentphone", pstudentphone);
                formData.append("cflag", cflag);
                formData.append("pstudent", pstudent);
                formData.append("gstudentphone", gstudentphone);
                formData.append("mbphone", mbphone);
                formData.append("gclass", gclass);
                formData.append("hteacher", hteacher);
                formData.append("gstudent", gstudent);
                formData.append("deptcode", deptcode);

                let myUrl = apiurl + "/reg/infointro/new";

                $.ajax({
                    url: myUrl,
                    type: 'POST',
                    cache: false,
                    data: formData,
                    processData: false,
                    contentType: false
                }).done(function (res) {
                    let d = new Date();
                    $("#hmsg").text(res + " 提交成功！" + d.toGMTString());
                }).fail(function (res) {
                    let d = new Date();
                    $("#hmsg").text(res + " 提交失败！" + d.toGMTString());
                });

            });
        });
    </script>
</body>
</html>